From: Florian Müllner Date: Tue, 29 Jan 2019 21:56:03 +0000 (+0100) Subject: ibusCandidatePopup: Clarify assignment in condition X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~897^2^2~90 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=a9ed128dce5d303d2522866ffcee1b5a9e4d703e;p=gnome-shell.git ibusCandidatePopup: Clarify assignment in condition Most often it is a bug if the condition part of a for-loop contains the assignment operator rather than the comparison one, so tools rightfully emit a warning. Clarify that the assignment is intentional in this case by adding parentheses. Spotted by eslint. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/375 --- diff --git a/js/ui/ibusCandidatePopup.js b/js/ui/ibusCandidatePopup.js index 124426887..5bea99824 100644 --- a/js/ui/ibusCandidatePopup.js +++ b/js/ui/ibusCandidatePopup.js @@ -236,7 +236,7 @@ var CandidatePopup = class CandidatePopup { let indexes = []; let indexLabel; - for (let i = 0; indexLabel = lookupTable.get_label(i); ++i) + for (let i = 0; (indexLabel = lookupTable.get_label(i)); ++i) indexes.push(indexLabel.get_text()); Main.keyboard.resetSuggestions(); @@ -295,7 +295,7 @@ var CandidatePopup = class CandidatePopup { _setTextAttributes(clutterText, ibusAttrList) { let attr; - for (let i = 0; attr = ibusAttrList.get(i); ++i) + for (let i = 0; (attr = ibusAttrList.get(i)); ++i) if (attr.get_attr_type() == IBus.AttrType.BACKGROUND) clutterText.set_selection(attr.get_start_index(), attr.get_end_index()); }